<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>渲染一个项目列表</title>
</head>

<body>
    <h1>渲染一个项目列表</h1>
    <div style="color:gray">
        <p>体验使用<code>v-for</code>渲染列表。</p>
        <p>控制台里，输入 <code>app.todos.push({ text: '新项目' })</code>，你会发现列表最后添加了一个新项目。</p>
    </div>
    <div>
        <a href="/">回目录</a>
    </div>
    <hr>
    <div id="app">
        <ul>
            <li v-for="item in todos">
                {{ item.text }}
            </li>
        </ul>
    </div>
    <script src="/node_modules/vue/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                todos: [{
                        text: '吃饭'
                    },
                    {
                        text: '睡觉'
                    },
                    {
                        text: '打豆豆'
                    },
                ]
            }
        });
    </script>
</body>

</html>